<?php
// +----------------------------------------------------------------------
// | 幕小铺
// +----------------------------------------------------------------------
// | 版权所有 2016~2020 幕小铺科技（大连）有限公司
// +----------------------------------------------------------------------
// | 2020/06/02
// +----------------------------------------------------------------------

namespace app\erp\validate;

use think\Validate;

/**
 * 公共类 验证器 采购单入库验证
 * @package app\admin\validate
 * @author shiqiang
 */
class PurchaseWarehousing extends Validate
{
    protected $rule = [
		'id'			=> 'require|number|gt:0',
		// 'user_id'		=> 'require|number|gt:0',
		'type'			=> 'require|number|in:1,2',
		'order_id'		=> 'require|number|gt:0',
		'handled_by'	=> 'require',
		'order_sku'		=> 'require|array',
    ];

    protected $message  =   [
        'id' 			=> 'id格式错误',
        'user_id' 		=> 'user_id格式错误',
        'type' 			=> 'type格式错误',
        'order_id' 		=> 'order_id格式错误',
        'handled_by' 	=> 'handled_by格式错误',
        'order_sku' 	=> 'order_sku格式错误',
    ];

    //验证场景
    protected $scene = [
		'purchase_list'=>  [//列表
			'user_id',
        ],
        'purchase_add'=>  [//添加
			'user_id',
			'order_id',
			'handled_by',
			'order_sku',
        ],
		'purchase_details'=>  [//详情
			'user_id',
			'id',
        ],
    ];
}
